package com.xbongbong.paas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;

import java.util.Arrays;
import java.util.List;

/**
 * @author: wufeng
 * @date: 2018/9/10 10:25
 * @desrcption: 菜单类型
 */
public enum MenuTypeEnum {

    APP(0, "enum.menuType.memo.app"),
    GROUP(1, "enum.menuType.memo.group"),
    FORM(2, "enum.menuType.memo.form"),
    PROCESS_FORM(3, "enum.menuType.memo.process_form"),
    REPORT_FORM(4, "enum.menuType.memo.report_form"),
    MENU(5, "enum.menuType.memo.menu")
    ;

    /**
     * 类型，1 分组，2 表单，3 表单(开启流程)，4 统计
     */
    private Integer type;

    /**
     * 描述
     */
    private String memo;

    MenuTypeEnum(Integer type, String memo) {
        this.type = type;
        this.memo = memo;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getMemo() {
        return I18nMessageUtil.getMessage(memo);
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    public static String getName(Integer type){
        for (MenuTypeEnum menuTypeEnum : values()) {
            if(type.equals(menuTypeEnum.getType())){
                return menuTypeEnum.getMemo();
            }
        }
        return  "";
    }

    public static List<Integer> getFormList() {
        return Arrays.asList(FORM.getType(), PROCESS_FORM.getType(), REPORT_FORM.getType(), MENU.getType());
    }

}
